/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.click.app.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 *
 * @author ariel
 */
@Entity
@Table(name = "suppliers")
public class Supplier extends Person implements Serializable {

    private static final long serialVersionUID = 1L;
    
    private String razonSocial;
    private String address;
    private String nit;

    public Supplier() {
    }

    public Supplier(Long idSupplier) {
        super(idSupplier);
    }

    @Column(name = "razon_social", nullable = false)
    public String getRazonSocial() {
        return razonSocial;
    }

    public void setRazonSocial(String razonSocial) {
        this.razonSocial = razonSocial;
    }

    @Column(nullable = false)
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getNit() {
        return nit;
    }

    public void setNit(String nit) {
        this.nit = nit;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Supplier other = (Supplier) obj;
        if (this.getId() != other.getId() && (this.getId() == null || !this.getId().equals(other.getId()))) {
            return false;
        }
        if ((this.razonSocial == null) ? (other.razonSocial != null) : !this.razonSocial.equals(other.razonSocial)) {
            return false;
        }
        if ((this.address == null) ? (other.address != null) : !this.address.equals(other.address)) {
            return false;
        }
        if ((this.nit == null) ? (other.nit != null) : !this.nit.equals(other.nit)) {
            return false;
        }
        if ((this.getFirstName() == null) ? (other.getFirstName() != null) : !this.getFirstName().equals(other.getFirstName())) {
            return false;
        }
        if ((this.getLastName() == null) ? (other.getLastName() != null) : !this.getLastName().equals(other.getLastName())) {
            return false;
        }
        if ((this.getLastName2() == null) ? (other.getLastName2() != null) : !this.getLastName2().equals(other.getLastName2())) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.getId() != null ? this.getId().hashCode() : 0);
        hash = 23 * hash + (this.razonSocial != null ? this.razonSocial.hashCode() : 0);
        hash = 23 * hash + (this.address != null ? this.address.hashCode() : 0);
        hash = 23 * hash + (this.nit != null ? this.nit.hashCode() : 0);
        hash = 23 * hash + (this.getFirstName() != null ? this.getFirstName().hashCode() : 0);
        hash = 23 * hash + (this.getLastName() != null ? this.getLastName().hashCode() : 0);
        hash = 23 * hash + (this.getLastName2() != null ? this.getLastName2().hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append(this.getId())
                   .append(this.razonSocial).append(this.address).append(this.nit)
                   .append(this.getFirstName()).append(this.getLastName()).append(this.getLastName2())
                   .toString();
    }
}
